-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Update documentation for Arc::from_raw, Arc::increment_strong_count, and Arc::decrement_strong_count to clarify allocator requirement #134496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ibraheemdev (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…_count','decrement_strong_count'
This comment has been minimized.
This comment has been minimized.
I'm not sure I understand your example. Creating an The change itself looks good to me, but could we link to the appropriate |
@ibraheemdev You're absolutely right—
Regarding this issue, I think it would be helpful to explicitly mention Thanks for taking the time to review this. I hope this clarifies the issue and provides a reasonable update to the std doc. |
r=me after the one typo. |
Co-authored-by: Ibraheem Ahmed <ibraheem@ibraheem.ca>
Thanks! @bors r+ |
Related Issue:
This update addresses parts of the issue raised in #134242, where Arc's documentation lacks
Global Allocator
safety descriptions for three APIs. And this was confirmed by @workingjubilee :PR Description
This PR updates the document for the following APIs:
Arc::from_raw
Arc::increment_strong_count
Arc::decrement_strong_count
These APIs currently lack an important piece of documentation: the raw pointer must point to a block of memory allocated by the global allocator. This crucial detail is specified in the source code but is not reflected in the documentation, which could lead to confusion or incorrect usage by users.
Problem:
The following example demonstrates the potential confusion caused by the lack of documentation: